import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import operate from "@dfeidao/atom-nodejs/db/operate"
import { systemid, productid } from '../../atom/config';

interface Message {
	filter: {
		sub_process_no: string[]
	}
}

interface IWebResult {
	data: unknown;
	cookie?: {
		[name: string]: string;
	} | null;
	content_type?: string;
	headers?: {
		[key: string]: string;
	};
	attachment?: string;
	redirect?: string;
	status_code?: number;
}
// 表名	hidden_ck_deal_set				
// 标题	隐患检查后续处理选择集				
// 字段名称	字段标题	字段类型	字段长度	是否为空	是否主键
// _id	id	string	50	ⅹ	√
// sub_process_des	后续处理描述	string	50	√	ⅹ
// sub_process_no	后续处理编号	string	50	√	ⅹ

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders): Promise<IWebResult> {
	log('Service begin path:e:\Feidao\kh\src\processing-set\zj-000004\s001,action_id:' + action_id);

	const op = operate(action_id, session_id, systemid);
	op.del('hidden_ck_deal_set', { productid, sub_process_no: { $in: message.filter.sub_process_no } });
	const res = await op.exec();

	log('Service end path:e:\Feidao\kh\src\processing-set\zj-000004\s001,action_id:' + action_id);
	return {
		data: res
	};
}
